package com.hrg.seer.sdk.rbk.api;

import lombok.Getter;

import static com.hrg.seer.sdk.rbk.api.MiscApiEnum.*;

@Getter
public enum RollerOperationType {

	FrontRoll(ROBOT_OTHER_ROLLER_FRONT_ROLL_REQ, "辊筒(皮带)向前滚动", "roll", "RollerRoll","front"),
	BackRoll(ROBOT_OTHER_ROLLER_BACK_ROLL_REQ, "辊筒(皮带)向后滚动", "roll", "RollerRoll", "back"),
	LeftRoll(ROBOT_OTHER_ROLLER_LEFT_ROLL_REQ, "辊筒(皮带)向左滚动", "roll", "RollerRoll", "left"),
	RightRoll(ROBOT_OTHER_ROLLER_RIGHT_ROLL_REQ, "辊筒(皮带)向右滚动", "roll", "RollerRoll", "right"),
	FrontLoad(ROBOT_OTHER_ROLLER_FRONT_LOAD_REQ, "辊筒(皮带)前上料", "load", "RollerLoad", "front"),
	FrontUnload(ROBOT_OTHER_ROLLER_FRONT_UNLOAD_REQ, "辊筒(皮带)前下料", "unload", "RollerUnload", "front"),

	FrontPreLoad(ROBOT_OTHER_ROLLER_FRONT_PRE_LOAD_REQ, "辊筒(皮带)前预上料", "preload", "RollerPreLoad", "front"),

	BackLoad(ROBOT_OTHER_ROLLER_BACK_LOAD_REQ, "辊筒(皮带)后上料", "load", "RollerLoad", "back"),
	BackUnload(ROBOT_OTHER_ROLLER_BACK_UNLOAD_REQ, "辊筒(皮带)后下料", "unload", "RollerUnload", "back"),

	BackPreLoad(ROBOT_OTHER_ROLLER_BACK_PRE_LOAD_REQ, "辊筒(皮带)后预上料", "preload", "RollerPreLoad", "back"),

	LeftLoad(ROBOT_OTHER_ROLLER_LEFT_LOAD_REQ, "辊筒(皮带)左上料", "load", "RollerLoad", "left"),
	LeftUnload(ROBOT_OTHER_ROLLER_LEFT_UNLOAD_REQ, "辊筒(皮带)左下料", "unload", "RollerUnload", "left"),
	RightLoad(ROBOT_OTHER_ROLLER_RIGHT_LOAD_REQ, "辊筒(皮带)右上料", "load", "RollerLoad", "right"),
	RightUnload(ROBOT_OTHER_ROLLER_RIGHT_UNLOAD_REQ, "辊筒(皮带)右下料", "unload", "RollerUnload", "right"),

	LeftPreLoad(ROBOT_OTHER_ROLLER_LEFT_PRE_LOAD_REQ, "辊筒(皮带)左预上料", "preload", "RollerPreLoad", "left"),
	RightPreLoad(ROBOT_OTHER_ROLLER_RIGHT_PRE_LOAD_REQ, "辊筒(皮带)右预上料", "preload", "RollerPreLoad", "right"),

	Stop(ROBOT_OTHER_ROLLER_STOP_REQ, "辊筒(皮带)停止", "stop", "RollerStop", "all"),
	;
	private final MiscApiEnum apiEnum;
	private final String chin;
	private final String operation;
	private final String operationFull;
	private final String side;
	RollerOperationType(MiscApiEnum apiEnum, String chin, String operation, String operationFull, String side) {
		this.apiEnum = apiEnum;
		this.chin = chin;
		this.operation = operation;
		this.operationFull = operationFull;
		this.side = side;
	}

	public static RollerOperationType getByOperationAndSide(String operation, String side) {
		for (RollerOperationType rollerOperationType : RollerOperationType.values()) {
			if (rollerOperationType.getOperation().equalsIgnoreCase(operation)
					&& rollerOperationType.getSide().equalsIgnoreCase(side)) {
				return rollerOperationType;
			}
		}
		return null;
	}

	public boolean isPreload() {
		return this.getOperation().equals("preload");
	}
	public boolean isLoad() {
		return this.getOperation().equals("load");
	}
	public boolean isUnload() {
		return this.getOperation().equals("unload");
	}
	public boolean isRoll() {
		return this.getOperation().equals("roll");
	}
	public boolean isStop() {
		return this.equals(Stop);
	}
}
